package com.example.yt_app.Othre;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.load.model.Model;
import com.example.yt_app.R;
import com.example.yt_app.adapter.Myadapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;

@SuppressWarnings("ALL")
public class activity_main extends AppCompatActivity {
    @BindView(R.id.rv)
    RecyclerView recyclerView;

    private ArrayList<Map<String, Object>>  datas;
    private Myadapter adapter;
    @SuppressWarnings({"AlibabaUndefineMagicConstant", "AlibabaCollectionInitShouldAssignCapacity"})
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

//绑定控件
        ButterKnife.bind(this);

        //模拟的数据（实际开发中一般是从网络获取的）
        datas = new ArrayList<>();
        Model model;
        //noinspection AlibabaUndefineMagicConstant
        for (int i = 0; i < 15; i++) {
            //noinspection AlibabaCollectionInitShouldAssignCapacity
            @SuppressWarnings("AlibabaCollectionInitShouldAssignCapacity")
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put("id", "请刷新");
            map.put("name","请刷新");
            map.put("online","请刷新");
            datas.add(map);
        }

        //创建布局管理
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(layoutManager);

        //创建适配器
        //adapter = new Myadapter(R.layout.simple_adapter_item, datas);

        //给RecyclerView设置适配器
       // recyclerView.setAdapter(adapter);
    }
}
